package com.fand.platform.authority.validator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

import com.fand.platform.authority.service.AuthorityService;

import com.fand.platform.authority.dto.UserGrUsDto;

/**
 * 用户组与用户
 *
 * @author yaoHT
 * 
 */
@Component(UserGrUsValidator.BEAN_ID)
public class UserGrUsValidator implements Validator {
	public static final String BEAN_ID = "com.fand.platform.authority.validator.UserGrUsValidator";
	
	@Qualifier(AuthorityService.BEAN_ID)
	@Autowired(required = false)
	private AuthorityService authorityService;
	
	@Override
	public boolean supports(Class<?> clazz) {
		return UserGrUsDto.class.equals(clazz);
	}
	
	@Override
	public void validate(Object target, Errors errors) {
		UserGrUsDto userGrUs = (UserGrUsDto) target;
		
		//if (StringUtils.isBlank(userGrUs.getCode())) {
		//	errors.reject("userGrUs.code.required", "编号不能为空");
		//}
	}
}
